#include "main.h"
#include "ParseTS.h"
#include "ParseLen.h"

int ParseTS(FILE *pTsFile)
{
    int TsPackage_len;
    int TsTableType;
    int TsPosition = 0;
    unsigned char PackageHead_data [4] = {0};

    TsPackage_len = ParseLen(pTsFile, TsPosition);    //解析TS流数据包长度

    if(TsPackage_len == 0)
    {
        printf("The file is not the Transport Stream file\n");

        return -1;
    }

    printf("The file TsPosition: %d\n",TsPosition);
    printf("The file TsPackageLength: %d\n",TsPackage_len);

    ParseTs_Head(pTsFile, TsPosition, TsPackage_len, PackageHead_data);       //解析TS包头

    
    return 0;
}